<!DOCTYPE html>
<html>
<!-- Head -->
<head>

<title>iClean</title>

<!-- Style -->
	<link rel="stylesheet" href="${ctxPath}/assets/css/style.css" type="text/css" media="all" />

</head>
<!-- Head -->
<!-- Body -->
<body onload="startTime()">

<!-- Heading -->
	<h1>iClean SCADA</h1>
	<!-- //Headng -->
		<!-- Container -->
		<div class="container">

			<!-- Forecast -->
			<div class="forecast">

				<div class="today-weather">
					<ul>
							<li>室内空气质量</li>
							<li><div id="systemtime"></div></li>
							<li>
								<table>
									<tr>
										<td>室内</td>
										<td></td>
										<td></td>
										<td></td>
									</tr>
									<tr>
										<td>PM2.5</td>
										<td></td>
										<td></td>
										<td></td>
									</tr>
									<tr>
										<td class="font_green" id="airGrade">优</td>
										<td></td>
										<td></td>
										<td></td>
									</tr>
									<tr>
										<td colspan="4">
											<div class="temperature" id="airGradeValue">
												<p>${pm25Date}</p>
												<span>ug/m³</span>
											</div>
										</td>
									</tr>
									<tr>
										<td></td>
										<td></td>
										<td></td>
										<td>&nbsp;<img src="${ctxPath}/assets/images/pos.png"/>成都</td>
									</tr>
								</table>
							</li>
							<li id="indoor_li_1">
								<table>
									<tr>
										<td id="indoor_1">室外<br>149ug/m³<span class="font_orange">轻度污染</span></td>
										<td>室外 AQI<br>197<span class="font_yellow">良</span></td>
									</tr>
								</table>
							</li>
					</ul>
				</div>
			</div>

			<div class="forecast_item">
				<span>CO₂ </span>
				<span id="bigindex_co2">${co2Data}</span>
				<span>ppm</span>
			</div>

			<div class="forecast_item">
				<span>TOVC</span>
				<span id="bigindex_tvoc">${vocData}</span>
				<span style="margin-top: 1px;">ug/m³<div>优</div></span>
			</div>

			<div class="forecast_item">
				<span>温度</span>
				<span id="bigindex_tpr">${wddata}</span>
				<span>℃</span>
			</div>

			<div class="forecast_item">
				<span>湿度</span>
				<span id="bigindex_humidity">${sddata}<</span>
				<span>%RH</span>
			</div>

			<!-- //Forecast -->
			<div class="clear"></div>

		</div>
		<!-- //Container -->

	<!-- Footer -->
	<div class="footer">

		<!-- Copyright -->
		<div class="copyright">
			<p> &copy; 2020 . All Rights Reserved </p>
		</div>
		<!-- //Copyright -->

	</div>
	<!-- //Footer -->

<script type="text/javascript">
	var Feng = {
		ctxPath: "${ctxPath}",
		version: '${constants.getReleaseVersion()}'
	};
</script>
<script type="text/javascript" src="${ctxPath}/assets/common/js/jquery.min.js"></script>

<script type="text/javascript" >
	/*<![CDATA[*/
	function startTime() {
		var today = new Date();
		var h = today.getHours();
		var m = today.getMinutes();
		var s = today.getSeconds();
		m = checkTime(m);
		s = checkTime(s);

		var year=today.getYear()
		if(year<1000)
			year+=1900
		var day=today.getDay()
		var month=today.getMonth()
		var daym=today.getDate()
		if(daym<10)
			daym="0"+daym
		var dayarray=new Array("星期日","星期一","星期二","星期三","星期四","星期五","星期六")
		var montharray=new Array(" 01月"," 02月"," 03月"," 04月"," 05月"," 06月"," 07月"," 08月"," 09月"," 10月"," 11月"," 12月")

		document.getElementById('systemtime').innerHTML = year+" 年"+montharray[month]+" "+daym+" 日 " +dayarray[day] + " &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" +
				h + ":" + m + ":" + s;

		var t = setTimeout(startTime, 500);
	}
	function checkTime(i) {
		if (i < 10) {i = "0" + i}; // add zero in front of numbers < 10
		return i;
	}

	$(function A() {
		$.ajax({
			//请求方式
			type : "POST",
			//请求的媒体类型
			contentType: "application/json;charset=UTF-8",
			//请求地址
			url : Feng.ctxPath + "/bigindexonevalue",
			//数据，json字符串
			data : "",
			//请求成功
			success : function(result) {
				console.log(result);
				$('#airGradeValue p').text(result[12]);
				$('#bigindex_co2').text(result[13]);
				$('#bigindex_tvoc').text(result[14]);
				$('#bigindex_tpr').text(result[10]);
				$('#bigindex_humidity').text(result[11]);
			},
			//请求失败，包含具体的错误信息
			error : function(e){
				console.log(e.status);
				console.log(e.responseText);
			}
		});

		var t = setTimeout(A, 2000);
	});

	/*]]>*/

</script>

</body>
<!-- //Body -->

</html>